<link rel="stylesheet" href="css/contact_vttai.css" type="text/css" />
<?php
	/*Hàm phân trang*/
	include_once('libs/htdu_core.php');
	$exe_mysql = new execute_mysql_query();
	$g_func = new global_function();
	@$cur_page  = str_replace('-','',$_GET['page']);
	$ROWS_PER_PAGE = 6;
	$total_record = $exe_mysql->execute("select id from node where id_type = 4", 2);
	$begin = $g_func->get_begin($cur_page, $ROWS_PER_PAGE, $total_record);
?>

<?php
	/*Hàm giới hạn chữ khi hiển thị*/
	function cut($str, $len) 
	{
		$str = trim($str);
		if (strlen($str) <= $len) return $str;
		$str = substr($str, 0, $len);
		if ($str != "") {
			if (!substr_count($str, " ")) return $str." ...";
			while (strlen($str) && ($str[strlen($str) - 1] != " ")) $str = substr($str, 0, -1);
			$str = substr($str, 0, -1)." ...";
		}
		return $str;
	}	
?>

<div class="main_pro">
	<?php
		include_once('libs/htdu_core.php');
		$exe_mysql = new execute_mysql_query();
		$result = $exe_mysql->execute("select * from node where id_type = 4 order by id desc limit $begin, $ROWS_PER_PAGE",0);
		while($row = mysql_fetch_array($result))
		{
			//Cách gọi hàm có sẳn để sử dụng
			$func = new global_function();
			$str = $func->remove_sign($row["title_".$LOCAL]);
				echo '<div class="main_left">';
					echo '<div>'.'<a href="chi-tiet-du-an-'.$str.'-'.$row['id'].'.html" ><img src="'.$row['img'].'" id="img" /></a>'.'</div>';
					echo '<div class="title">'.'<a href="chi-tiet-du-an-'.$str.'-'.$row['id'].'.html">'.cut($row['title_'.$LOCAL],35).'</a>'.'</div>';
					echo '<div class="content">'.cut($row['description_'.$LOCAL],180).'</div>';
					echo '<div>'.'<a href="chi-tiet-du-an-'.$str.'-'.$row['id'].'.html" class="view-more">'.$MULTI_LANG->get_word_by_key('read_more').'</a>'.'</div>';
				echo '</div>';
		}
	?>
</div>
<div class="phan_trang">
	<?php
	$g_func->paging($total_record, $ROWS_PER_PAGE);
	?>
</div>

